#bilibili排名算法 v2.3(2011.4.5)
#评论分: 评论数*(50,50*(收藏数*100/(点击数+评论数*50))).min
#收藏分: 收藏数*(100,24000/收藏数 + 20).min
class Results::R23 < Results::R21

  def self.version
    self.to_s.split('::R').last.to_f / 10
  end

  def self.get_comment_revised clicks, comments, stows
    if comments <= 0
      E_C.to_f
    else
      [format("%.2f", E_C * (stows * E_S) / (clicks.to_f + comments.to_f * E_C)).to_f, E_C.to_f].min
    end
  end

  def comment_revised
    self.class.get_comment_revised clicks, comments, stows
  end

  def self.get_stow_revised stows
    if stows <= 300
      E_S
    else
      fixed = (E_S*300 + 20*(stows - 300))/stows.to_f
      format("%.2f", fixed).to_f
    end
  end

  def stow_revised
    self.class.get_stow_revised stows
  end

  def click_point
    clicks * click_revised
  end

  def comment_point
    comments * comment_revised
  end

  def stow_point
    stows * stow_revised
  end
  
  def get_ranking_point
    format("%.2f", (click_point + comment_point + stow_point) * space_fix).to_f
  end
  
end
